class Item {
  /// id
  late int id;

  /// 物品名称
  late String name;

  /// 物品存放地址
  late int location;

  /// 生产日期
  late DateTime productionDate;

  /// 有效日期
  late int expirationDays;

  /// 物品类型
  late int type;

  /// 物品数量
  late int number;

  /// 用户id
  late int userId;

  /// 创建者
  late String createBy;

  /// 创建时间
  late DateTime createTime;

  /// 修改者
  late String updateBy;

  /// 修改时间
  late DateTime updateTime;

  Item({
    required this.id,
    required this.name,
    required this.location,
    required this.productionDate,
    required this.expirationDays,
    required this.type,
    required this.number,
    required this.userId,
  });

  factory Item.fromJson(Map<String, dynamic> json) {
    return Item(
      id: json['id'],
      name: json['name'],
      location: json['location'],
      productionDate: DateTime.parse(json['productionDate']),
      expirationDays: json['expirationDays'],
      type: json['type'],
      number: json['number'],
      userId: json['userId'],
    );
  }
}
